package aole;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.scene.chart.XYChart.Series;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

public class Test1 extends Application {

	/**
	 * @param args
	 */
	public static void main( String[] args ) {
		launch( args );
	}

	@Override
	public void start( Stage stage ) throws Exception {
		// create UI
		final NumberAxis xAxis = new NumberAxis();
		final NumberAxis yAxis = new NumberAxis();

		final LineChart< Number, Number > lineChart = new LineChart<>( xAxis,
				yAxis );

		Series< Number, Number > series = new XYChart.Series<>();

		// populate chart
		double a = 1;
		double b = 0;
		double c = 0;
		double y;

		for( double x = -1; x < 1; x += 0.01 ) {
			y = a * x * x + b * x + c;
			y=1-y;
			series.getData().add( new XYChart.Data< Number, Number >( x, y ) );
		}
		series.getData().add( new XYChart.Data< Number, Number >( 1, 1 ) );
		//
		lineChart.getData().add( series );

		BorderPane root = new BorderPane();
		root.setCenter( lineChart );
		Scene scene = new Scene( root, 800, 600 );

		stage.setScene( scene );
		stage.show();
	}

}
